<!DOCTYPE html>
<html lang="zh">
	<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>统计端-基础信息</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<!-- 这个是所有jquery插件的基础，首先第一个引入 -->
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<link rel="stylesheet" href="jqgrid/css/bootstrap.min.css" />
		<link rel="stylesheet" href="jqgrid/css/common.css" />
		<link rel="stylesheet" href="jqgrid/css/layui.css" />

		<script src="js/common.js"></script> 
		<script src="js/province.js"></script> 
		<script src="js/layui.js"></script> 
	
		
	<style type="text/css">

body {
	background: #fff; /* fallback for old browsers */
	/* background: -webkit-linear-gradient(right, #2087df, #2087df);
	background: -moz-linear-gradient(right, #76b852, #8DC26F);
	background: -o-linear-gradient(right, #76b852, #8DC26F);
	background: linear-gradient(to left, #76b852, #8DC26F); */
	font-family: "Roboto", sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* padding: 0px 20px; */

}
.btn-upload{
	/* background: #5dadef;
	width: 200px;
	height: 40px;
	line-height: 40px;
	text-align: center;
	color: #fff;
	border-radius: 3px;
	cursor: pointer; */
	display: block!important;
}
.file{
	margin-bottom: 10px;
}
.prt{
	cursor: pointer;
}
.select-all{
	margin: 5px 0;
}
.form-item{
	margin: 30px 0;
}
.item-title{
	border-left: 3px solid #009688;
	padding-left: 10px;
	margin-bottom: 10px;
	font-size: 16px;
	font-weight: 600;
}
.isSeclet{
	color:#009688;
}
.item-con{
	padding-left: 10px;
}
.list{
	margin-bottom: 15px;
}
.select-all{
	display: inline-block;
	margin-top: 15px;
}
.result-box{
	display: none;
}
.error-box{
	color: red;
	display: none;
}

.mg0{
	margin-left: 0;
}
.layui-form-select{
	display: inline-block;
	margin-right: 30px;

}
.province{
}
</style>
	</head>
	<body>
		<header class="nav">
			<ul class="layui-nav layui-bg-green" lay-filter="">
				<li data-link="statisticsList" class="layui-nav-item"><a href="#">统计端-查询</a></li>
				
				<li data-link="statistics" class="layui-nav-item"><a href="#">统计端-统计</a></li>
				<li data-link="uploadtable" class="layui-nav-item"><a href="#">统计端-导入表格</a></li>
				<li data-link="restdata" class="layui-nav-item layui-this"><a href="#">统计端-初始化</a></li>
				<li data-link="login" class="layui-nav-item " style="float: right;"><a href="#">退出</a></li>
				<li data-link="update" class="layui-nav-item " style="float: right;"><a href="#">修改密码</a></li>
			  </ul>
		</header>
		<div class="page content">
			<form class="selected-wrap" id="form1" action="Upload" method="post"  enctype="multipart/form-data">
				
			
			<div class="form-item layui-form">
				<div class="item-title">
					基础信息更新范围：				
				</div>
				<div class="layui-form-item">
					<!-- <label class="layui-form-label">单选框</label> -->
					<div class="layui-input-block mg0">
						 <input type="radio" name="radio" value="0" title="选择网省" checked>
					  <select class="province" id="eprovinceName"></select>
					  <input type="radio" name="radio" value="1" title="全部更新（初始化）">
					 
					</div>
				  </div>
				<!-- <div class="item-con">
						<div >
						
					  </div>
					  <div class="select-all prt">
						全部更新（初始化）
					</div>
				</div> -->
			
			</div>

			<div class="form-item">
				<div class="item-title">
					请选择要导入的文件：（单选，xls或xlsx格式）						

				</div>
				<div class="item-con">
					<div id="form1">
						<input type="file" name="upfile" id="upfile" class="file" value="" accept=".xls,.xlsx" />
						<button type="button" class=" btn-upload layui-btn" id="btn">立即上传</button>
					</div>
				</div>
			</div>

			<div class="error-box">

			</div>
			<div class="form-item result-box">
				<div class="item-title">
					初始化结果：
				</div>
				<div class="item-con">
					<div class="list">
						<span  class="con-title">导入省公司：</span>
						<span class="sheng">
							
						</span>
					</div>
					<div class="list">
						<span  class="con-title">导入初始化数据数量：</span>
						<span class="number">
							
						</span>
					</div>
					<div class="list">
						<span  class="con-title">修改数量：</span>
						<span class="xgsl">
							
						</span>
					</div>
					<div class="list">
						<span  class="con-title">删除数量：</span>
						<span class="scsl">
							
						</span>
					</div>
					<div class="list">
						<span  class="con-title">新增数量：</span>
						<span class="xzsl">
							
						</span>
					</div>
					
					
				</div>
			</div>
	
		</form>
		
			
		</div>
		

<script type="text/javascript">
layui.use('form',function(){
  var form = layui.form;

  form.render();

  form.on('select(formDemo)', function(data){
    selectFun();

});

});
	$(function(){
		var isall

		$("#btn").click(function(){
			var formData = new FormData();
			var provinceName
			var province = $("#eprovinceName").val(); 
			var isAll=$('input[name="radio"]:checked').val();
			if(isAll==1){
				provinceName=''
			}else{
				if(province==''){
					layer.msg('请选择城市');

				}else{
					provinceName=province

				}
			}
            formData.append("file",document.getElementById("upfile").files[0]);
			formData.append("provinceName",provinceName);
			console.log(formData)
            $.ajax({
				// contentType: 'application/json',
				processData: false, //jquery 是否对数据进行 预处理
                // contentType: "multipart/form-data" ,// 不要自己修改请求内容类型
                contentType: false ,// 不要自己修改请求内容类型
                type: "POST", // 数据提交类型
                url: "http://localhost:8888/chx/initdata/importexcel", // 发送地址
                data:formData, //发送数据
                async: true, // 是否异步
                // processData: false, //processData 默认为false，当设置为true的时候,jquery ajax 提交的时候不会序列化 data，而是直接使用data
				// contentType: false //
				success:function(res){
					if(res.code==200&&res.success){
						var listdata=res.data
						$('.number').html(listdata.count)
						$('.xzsl').html(listdata.insert)
						$('.xgsl').html(listdata.update)
						$('.sheng').html(listdata.provincecompanyname)
						$('.scsl').html(listdata.delete)
						$('.result-box').show()
						$('.error-box').hide()
					}else{
						$('.result-box').hide()
						$('.error-box').show()
						$('.error-box').text(res.msg)
					}

				}
            });
        });
		
	})
	</script>
			<div id="updatepassword" class="updatepwd">
				<form action="" class="layui-form" lay-filter="form" method="post">
					<div class="layui-form-item">
						<label class="layui-form-label" style="width: 100px;">旧密码</label>
						<div class="layui-input-inline">
						  <input  type="password" name="originalPassword" required lay-verify="originalPassword" placeholder="请输入旧密码" autocomplete="off" class="layui-input">
						</div>
					  </div>
					<div class="layui-form-item">
					  <label class="layui-form-label" style="width: 100px;">新密码</label>
					  <div class="layui-input-inline">
						<input  type="password" name="newPassword" required lay-verify="newPassword" placeholder="请输入新密码" autocomplete="off" class="layui-input">
					  </div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label" style="width: 100px;">确认密码</label>
						<div class="layui-input-inline">
						  <input  type="password" name="confirmPassword" required lay-verify="confirmPassword" placeholder="请输入确认密码" autocomplete="off" class="layui-input">
						</div>
					  </div>
					<div class="layui-form-item">
					  <div style="text-align: center;">
						<button type="button" id="submit" class="layui-btn" lay-submit lay-filter="submit">确定</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					  </div>
					</div>
				</form>
			</div> 
</body>
</html>